package dao;

import pojo.Note;

import java.sql.SQLException;
import java.util.ArrayList;

public interface NoteDao {
    /**
     * 添加笔记
     *
     * @param note
     * @return
     * @throws SQLException
     */
    boolean addNote(Note note) throws SQLException;

    /**
     * 修改笔记内容
     *
     * @param nid
     * @param note
     * @return
     * @throws SQLException
     */
    boolean updateNote(Integer nid, Note note) throws SQLException;

    /**
     * 根据nid删除note
     *
     * @param nid
     * @return
     * @throws SQLException
     */
    boolean delNote(Integer nid) throws SQLException;

    /**
     * 查看所有用户发布的所有笔记---for系统管理员
     *
     * @return
     * @throws SQLException
     * @throws ClassNotFoundException
     */
    ArrayList<Note> allNotes() throws SQLException, ClassNotFoundException;

    /**
     * 查看某个具体用户的所有笔记
     *
     * @param usename
     * @return
     * @throws SQLException
     * @throws ClassNotFoundException
     */
    ArrayList<Note> userAllNotes(String usename) throws SQLException, ClassNotFoundException;

    /**
     * 根据id查找某个笔记--用于用户修改笔记
     *
     * @param nid
     * @return
     * @throws SQLException
     * @throws ClassNotFoundException
     */
    Note findNote(Integer nid) throws SQLException, ClassNotFoundException;

    /**
     * 查看用户审核中的笔记
     *
     * @param usename
     * @return
     * @throws SQLException
     * @throws ClassNotFoundException
     */
    ArrayList<Note> userCheckedNote(String usename) throws SQLException, ClassNotFoundException;

    /**
     * 修改笔记状态
     *
     * @param nid
     * @return
     * @throws SQLException
     */
    boolean updateStyle(Integer nid) throws SQLException;

    /**
     * 查询总笔记数
     *
     * @return
     * @throws SQLException
     */
    Integer totalNotes() throws SQLException;

    /**
     * 查询某区域总笔记数
     *
     * @param type
     * @return
     * @throws SQLException
     */
    Integer AreaTotalNotes(String type) throws SQLException;

    /**
     * 获取用户发布通过的笔记数量
     *
     * @param usename
     * @return
     * @throws SQLException
     */
    Integer userTotalNote(String usename) throws SQLException;

    /**
     * 用户待审核笔记数量
     *
     * @param usename
     * @return
     * @throws SQLException
     */
    Integer userTotalCheckedNote(String usename) throws SQLException;

    /**
     * 具体区域审核笔记数
     *
     * @param type
     * @return
     * @throws SQLException
     */
    Integer areaCheckedNotes(String type) throws SQLException;

    /**
     * 查询某用户某区域总笔记数
     *
     * @param usename
     * @param type
     * @return
     * @throws SQLException
     */
    Integer userAreaTotalNotes(String usename, String type) throws SQLException;

    /**
     * 查询添加笔记的id
     *
     * @param note
     * @return
     * @throws SQLException
     */
    Integer findUserNoteNid(Note note) throws SQLException;

    /**
     * 查询搜索后总笔记数
     *
     * @param content
     * @return
     * @throws SQLException
     */
    Integer afterSearchTotalNotes(String content) throws SQLException;
}
